// github privides a Go API for the GitHub issue tracker.
// See https://developer.github.com/v3/search/#search-issures.
package main

import (
	"fmt"
	"gopl/ch4/github"
	"log"
	"os"
)

func main() {
	result, err := github.SearchIssues(os.Args[1:])
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d issues:\n", result.TotalCount)
	itemss := github.ClassifyIssues(result.Items)
	for classify, items := range itemss {
		fmt.Println(classify)
		for _, item := range items {
			fmt.Printf("#%-5d %9.9s %.55s\n", item.Number, item.User.Login, item.Title)
		}
	}

}
